
// 保养计划
import qs from 'qs'
import request from "@/utils/request"






/**
 *GET 获取当前用户保养任务
  * @params
 * @return {*}
 */
export function getCurrentMaintenanceList(params) {
  return request({
    url: "/maintenancePlan/getCurrentUserList?" + qs.stringify(params),
    method: "get"
  });
}



/**
 *GET 获取保养计划列表
  * @params

 * @return {*}
 */
export function getMaintenancePlanList(params) {
  return request({
    url: "/maintenancePlan/getList?" + qs.stringify(params),
    method: "get",
  })
}
/**
 *GET 获取保养计划所有数据
  * @params

 * @return {*}
 */
export function getMaintenanceAll(state='') {
  return request({
    url: "/maintenancePlan/getAll?state=" + state,
    method: "get",
  })
}
/**
 *GET 通过保养计划获取设备
  * @params

 * @return {*}
 */
export function getMaintenanceDeviceByPlanId(planId) {
  return request({
    url: "/maintenancePlan/getMaintenanceDeviceByPlanId?planId=" + planId,
    method: "get",
  })
}

/**
 *GET 获取保养计划详情
  * @params
 * @return {*}
 */
export function getMaintenanceInfo(id) {
  return request({
    url: "/maintenancePlan/getInfo?id=" + id,
    method: "get",
  })
}
/**
 *GET 通过设备组获取设备类型和设备以及保养标准保养项目
  * @params
 * @return {*}
 */
export function getMaintenanceListByDeviceGroup(deviceGroupIdList) {
  return request({
    url: "/maintenanceStandards/getListByDeviceGroup?deviceGroupIdList=" + deviceGroupIdList,
    method: "get",
  })
}


/**
 * 新增保养计划
 * @return {*}
 */
export function addMaintenancePlan(data) {
  return request({
    url: "/maintenancePlan/add",
    method: "post",
    data
  })
}

/**
 * 修改保养计划
 * @return {*}
 */
export function updateMaintenancePlan(data) {
  return request({
    url: "/maintenancePlan/update",
    method: "post",
    data
  })
}
/**
 * 更新保养计划状态
 * @return {*}
 */
export function updateStateMaintenancePlan(data) {
  return request({
    url: "/maintenancePlan/updateState",
    method: "post",
    data
  })
}

/**
 * 删除保养计划
 * @return {*}
 */
export function deleteMaintenanceById(id) {
  return request({
    url: "/maintenancePlan/delete?id=" + id,
    method: "delete",
  })
}
